class Demo2_Operator{
    public static void main (String[] args){
        //请自己实现两个变量的狡猾（不需要定义第三方变量)
        int x = 10;
        int y = 5;

        //需要第三方变量
       /* int temp;
        temp = x;
        x = y;
        y = temp ; 
    
       //不需要定义第三方变量
       x = x + y;     //10+5=15
       y = x-y;       //15-5=10
       x = x - y;     //15-10 = 5  */

       //用异或的方式
       x = x ^ y;    //x = 10^5
       y = x ^ y;    //y = 10^5^5   y=10  相当于10被5异或2次还是等于10
       x = x ^ y;    //x = 10^5^10  x=5  相当于5被10异或2次，还是等于5

        System.out.println("x = " + x +",y = " + y);
    }
}